<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld"%>
<!DOCTYPE HTML>
<html>
<head>
    <title>角色管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
    <base href="<%=basePath%>">
    <link rel="stylesheet" type="text/css" href="css/pager.css" />
    <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="bootstrap/css/style.css" />
     <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
        .mouseover:hover{cursor:hand;color:#0000FF}
    </style>
   	<script type="text/javascript" src="js/jquery.min.js"></script>
   	<script type="text/javascript" src="js/lhgdialog/lhgdialog.min.js"></script>
	<script src="js/jquery.pager.js"></script>
	<script type="text/javascript">
    	$(function (){  
    		$("#type").val(${type});
    		$("#pager").pager({ pagenumber: $("#current").val(), pagecount: $("#totalPage").val(), buttonClickCallback: PageClick});
    	});	
    	var PageClick = function(pageclickednumber) {
		    $("#current").val(pageclickednumber);
		    $("#syslogForm").submit();
		};	
		function  UpdateData(id){
			$.dialog({title:'角色信息',content: "url:user/updateRoleInit.do?id="+id,width:'500px',height: 280,lock: true});
		};
		function AddData(){
			$.dialog({title:'角色信息',content: "url:system/role_add.jsp",width:'500px',height: 280,lock: true});
		};
		function  RoleAuthority(id){
			$.dialog({title:'角色/功能信息',content: "url:user/updateRoleAuthorityInit.do?id="+id,width:'500px',height: 380,lock: true});
		};
    </script>
    
</head>
<body >
	<form name = "syslogForm" id = "syslogForm" class="form-inline definewidth m20"  action="user/queryRole.do" method="post">
	             角色名称：
		<input name="name" id="name" value = "${param.name}" type="text" style="width:100px" />
<!-- 		 角色代号： -->
<!-- 		<input name="code" id="code" value = "${param.code}" type="text" style="width:100px" -->
<!-- 		/> -->
		状态：${param.status }
		<select  name = "status" id = "status" style="width:100px" >
	    	<option value=""	<c:if test= "${empty param.status}">selected</c:if>>全部</option>
	    	<option value="0" 	<c:if test="${param.status eq '0'}">selected</c:if>>无效</option>
	    	<option value="1" 	<c:if test="${param.status eq '1'}">selected</c:if>>有效</option>
	    </select>
	    <input type="submit" class="btn btn-primary" value = "查询">
	    <input type="button" class="btn btn-success" id="btnGetFocMonthData" 
						value="新增" onclick="AddData()" />
	    <input type = "hidden" name = "pageSize" id = "pageSize" value="30"/>
		<input type = "hidden" name = "current" id = "current" value="${pageResult.current}"/>
		<input type = "hidden" name = "totalPage" id = "totalPage" value="${pageResult.totalPage}"/>
		
	</form>
    <table class="table table-bordered table-hover definewidth m10">
	    <thead>
	    <tr>
	   		<th width=10%>名称</th>
<!-- 	        <th width=10%>代号</th> -->
	        <th width=10%>说明</th>
	        <th width=10%>状态</th>
	        <th width=10%>更新日期</th>
	        <th width=10%>操作</th>
	    </tr>
	    </thead>
		<c:forEach items="${pageResult.list}" var="nsVar" varStatus = "status">
    	<tr>
			<td>${nsVar.name}</td>
<!-- 			<td>${nsVar.code}</td> -->
			<td>${nsVar.description}</td>
			<td>
				<c:if test = "${nsVar.status=='0'}">无效</c:if>
	      		<c:if test = "${nsVar.status=='1'}">有效</c:if>
	      	</td>
			<td>${nsVar.updateTime}</td>
			<td>
				<a href="javascript:void(0)" onclick="UpdateData('${nsVar.id}');">修改</a>&nbsp;
				<a href="javascript:void(0)" onclick="RoleAuthority('${nsVar.id}');">设置功能</a>
			</td>
		</tr>
		</c:forEach>
	</table>
    <div id="pager" style="float:right;height:24px;padding-right:30px;"></div>
</body>
</html>